<template>
  <div id="painting">
    <div class="center">
      <div class="toptile">
        <b>手绘插画</b>
      </div>
      <div class="list">
        <ul>
          <li v-for="(item,index) in paintinglist" :key="index"  @click="btn(item)">
            <div class="listimg">
              <img :src="item.listimg" alt>
            </div>
            <div class="listcontent">
              <p>
                <b>{{item.listtitle}}</b>
              </p>
              <span>{{item.listcontent}}</span>
              <div><b>￥{{item.price}}元</b></div>
            </div>
          </li>
        </ul>
      </div>
      <div class="toptile">
        <b>视频创作</b>
      </div>
      <div class="list">
        <ul>
          <li v-for="(item,index) in paintinglist2" :key="index"  @click="btn(item)">
            <div class="listimg">
              <img :src="item.listimg" alt>
            </div>
            <div class="listcontent">
              <p>
                <b>{{item.listtitle}}</b>
              </p>
              <span>{{item.listcontent}}</span>
              <div><b>￥{{item.price}}元</b></div>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import getlink from "@/api/getapi.js";
export default {
  methods: {
    btn(item) {
      this.$router.push({
        path: "/details",
        query: {
          id: item.id,
          img: item.listimg,
          title: item.listtitle,
          listcontent: item.listcontent,
          price: item.price
        }
      });
    }
  },
  data() {
    return {
      paintinglist: [],
      paintinglist2: []
    };
  },
  mounted() {
    getlink("/mock/data/Btlist").then(data => {
      this.paintinglist = data.data.comn4;
      this.paintinglist2 = data.data.comn2;
    });
  }
};
</script>
<style scoped>
#painting {
  width: 100%;
}
.center {
  width: 3.45rem;
  margin: auto;
}
.toptile {
  width: 100%;
  height: 0.5rem;
  line-height: 0.5rem;
  font-size: 0.16rem;
}
.list {
  width: 100%;
}
.list ul {
  width: 100%;
}
.list ul li {
  width: 100%;
  height: 0.66rem;
  margin-bottom: 0.3rem;
}
.listimg {
  width: 1.18rem;
  height: 100%;
  float: left;
  margin-right: 0.15rem;
}
.listimg img {
  width: 100%;
  height: 100%;
}
.listcontent {
  width: 1.95rem;
  height: 100%;
  float: left;
}
.listcontent p {
  width: 100%;
  height: .3rem;
  font-size: 0.14rem;
  line-height: 0.2rem;
}
.listcontent span {
  width: 100%;
  height: .3rem;
  font-size: 0.12rem;
  line-height: 0.3rem;
  display: block;
}
.listcontent div{
  width: 100%;
  height: .3rem;
  font-size: .12rem;
  line-height: .3rem;
  color: orange;
}
</style>